<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<%@ taglib prefix="his_fns" uri="/WEB-INF/tlds/his_fns.tld" %>
<script type="text/javascript">

    $(function () {
        $("#contentTable").treeTable();
    })
    function changeFun(){
        $("#administration").val("");
        var arr = $("select[name='adminis']").val();
        $("#administration").val(arr);
    }
    function trFun(id,pid,vid,bedNo) {
        $("#orderId").val(id);
        $("#patientId").val(pid);
        $("#visitId").val(vid);
        $("#bedNo").val(bedNo);
    }
    function bottleLabelPrint() {
        var orderId = $("#orderId").val();
        var patientId = $("#patientId").val();
        var visitId = $("#visitId").val() ;
        var bedNo = $("#bedNo").val();
        /*  if(orderId=="" || patientId==''){
         toastr.error('请先选择要打印的相应病人的医嘱瓶签！');
         }else{*/
        printPdf("${ctx}/orders/orders/ordersBottleLabelPrint","id="+orderId+"&patientId="+patientId+"&visitId="+visitId+"&bedNo="+bedNo)
        /* }*/
    }
    /*$(function(){
        var temp = '${orders.type}'.split(',');
        for(var i=0;i<temp.length;i++) {
            $(':checkbox[name="type"][value="' + temp[i] + '"]').prop('checked', true)
        }
       *//* var temp1 = '${orders.repeatIncaditor}'.split(',');
        for(var i=0;i<temp1.length;i++) {
            $(':checkbox[name="repeatIncaditor"][value="' + temp1[i] + '"]').prop('checked', true)
        }*//*

        $('#searchFormDict input[name=repeatIncaditor]').click(function(){
            $(this).siblings('input[name=repeatIncaditor]').each(function(){
                this.checked=false;
            });
           $('#btnSubmit').click();
        });

        $('#searchFormDict input[name=type]').click(function(){
           $('#btnSubmit').click();

        });
    });*/
    /*function onaa(){
        $("#rigthCenterDiv").load('${ctx}/orders/orders/inPatVisitInfoOrders?');
    }*/
</script>
<div class="app">
    <section class="layout">
        <section class="main-content col-lg-12" id="LeftDiv">
            <div class="content-wrap">
                <div class="wrapper" style="bottom: 50px;">

                    <section class="panel panel-default">
                        <div class="panel-body">
                            <div class="table-responsive no-border">
                                <div class="datatable-top">
                                    <div class="pull-left">

                                        <form:form id="searchFormDict" modelAttribute="orders" onsubmit="return loadDivForm('rigthCenterDiv','searchFormDict','${ctx}/orders/orders/inPatVisitInfoOrders');" method="post" class="form-inline">
                                            <label>时效：</label>
                                            <form:checkbox path="repeatIncaditor" value="" />&nbsp;全部
                                            <form:checkbox path="repeatIncaditor" value="1"/>&nbsp;长期
                                            <form:checkbox path="repeatIncaditor" value="0"/>&nbsp;临时
                                            &nbsp;&nbsp;<label>类别：</label>
                                            <form:checkbox path="type" value="0"/>&nbsp;输液类
                                            <form:checkbox path="type" value="1"/>&nbsp;注射类
                                            <form:checkbox path="type" value="2"/>&nbsp;口服类
                                            &nbsp;&nbsp;
                                            <label>途径：</label>
                                            <form:select path="adminis" htmlEscape="false" maxlength="50" class="form-control" multiple="multiple" onchange="changeFun()">
                                                <form:options items="${fns:getSysDictList('ADMINISTRATION_DICT')}" itemLabel="label" itemValue="id"></form:options>
                                            </form:select>
                                            <form:hidden path="administration" id="administration"/>
                                            &nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>

                                        </form:form>
                                    </div>
                                </div>
                                <input id="orderId" type="hidden" value=""/>
                                <input id="patientId" type="hidden" value=""/>
                                <input id="visitId" type="hidden" value=""/>
                                <input id="bedNo" type="hidden" value=""/>
                                <table id="contentTable" class="table table-bordered mg-t datatable">
                                    <thead><tr><th>医嘱</th><th>摆药</th><th>频次</th><th>用药途径</th><th>单次用量</th><th>单位</th></tr></thead>
                                    <tbody>
                                    <c:forEach items="${list}" var="o">
                                    <tr id="${o.id}" style="text-align: center;">
                                        <td>${o.orderText}</td>
                                        <td>${o.billingAttr}</td>
                                        <td>${fns:findFreqDesc(o.performFreq,'')}</td>
                                        <td>${fns:getSysDictLabel(o.administration,'ADMINISTRATION_DICT','')}</td>
                                        <td>${o.singleDose}</td>
                                        <td>${fns:getDictLabel(o.singleDoseUnit,'SPEC_UNIT','')}</td>
                                    </tr>
                                    <c:if test="${o.children.size()>0}">
                                    <c:forEach items="${o.children}" var="child" varStatus="ss">
                                    <tr id='${ss.count}' pId='${o.id}' style="text-align: center;">
                                        <td>${child.orderText}</td>
                                        <td>${child.billingAttr}</td>
                                        <td>${fns:findFreqDesc(child.performFreq,'')}</td>
                                        <td>${fns:getSysDictLabel(child.administration,'ADMINISTRATION_DICT','')}</td>
                                        <td>${child.singleDose}</td>
                                        <td>${fns:getDictLabel(child.singleDoseUnit,'SPEC_UNIT','')}</td>
                                    </tr>
                                    </c:forEach>
                                    </c:if>
                                    </c:forEach>
                                </table>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </section>
    </section>
</div>
